<?
header("Content-type: text/plane");

$q = $_REQUEST["q"];

if (strlen($q) > 0)
{
  $q = str_replace('"', '', $q);
  $q = str_replace("'", '', $q);
  $q = substr($q, 0, 50);

  $con = mysql_connect("localhost","user","mypass");
  if ($con)
  {
     mysql_select_db("db1", $con);

      $sql = "SELECT text FROM table1 WHERE text LIKE '%" . $q . "%'";
      $result = mysql_query($sql,$con);
      if ($row = mysql_fetch_array($result))
      {
	  $txt = $row["text"];
	  $txt = strtoupper($txt) . '!!!';
	  echo $txt;
      }
      else 
      {
	  echo 'no matches';
      }
  }
  mysql_close($con);
}

 
?>